/* 
 * File:   Constant.cpp
 * Author: Gab'z
 * 
 * Created on 27 mai 2012, 21:45
 */

//#include "Constant.h"
#include "../../Context.h"
#include "Number.h"
#include "Expression.h"
#include "log/Logger.h"

namespace calculator {
    Logger* Constant::log = LoggerManager::getInstance()->getLogger("Constant");

    Constant::Constant() : Literal() {
    }

    Constant::~Constant() {
    }

    void Constant::execute() const throw (CommandException) {
        // ajout à la pile courante
        // push() se charge de créer un clone
        // se charge de supprimer la commande à la fin de la méthode execute
        std::ostringstream oss;
        oss << "execute Constant : push ";
        oss << toString();
        oss << " in current stack";
        log->trace(oss.str());
        Context::getInstance()->getCurrentStack()->push(this);
        std::ostringstream oss2;
        oss2 << "currentStack.size() = ";
        oss2 << Context::getInstance()->getCurrentStack()->size();
        log->trace(oss2.str());
    }
}
